import React, { Component } from 'react'
import Axios from "axios"
import Header from "../common/Header"
import {Icon} from "antd"
import {connect} from "react-redux"
import {save_collectList_action} from "../../store/store"
class Deatil extends Component {
    constructor(){
        super()
        this.state={

        }
    }
    componentDidMount(){
        Axios.get("/list").then(res=>{
            console.log(res.data.list)
        })
    }
    render() {
        console.log(this.props.location.state,`-----`,this.props.collectList)
        return (
            <div className="detail">
                <Header back={<span onClick = {()=>{this.props.history.go(-1)}}><Icon type="left" /></span>} title="" ope="..." theme="light"></Header>
                <div className="d-content">
                    <div className="d-shopTit">
                        <img src={this.props.location.state.obj.img} alt=""/>
                        <div className="d-stcont">
                            <div className="dt">
                                <h3>{this.props.location.state.obj.title}</h3>
                                <span onClick={()=>{this.props.saveCollectList(this.props.location.state.obj)}}>♡</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div className="d-botton">
                    
                </div>
            </div>
        )
    }
}

export default connect(
    (state)=>{
        return {
            collectList:state.collectList
        }
    },
    (dispatch)=>{
        return {
            saveCollectList:(item)=>{
                dispatch(save_collectList_action(item))
            }
        }
    }
)(Deatil)
